load("@build_stack_rules_proto//rules:proto_plugin.bzl", "proto_plugin")

proto_plugin(
    name = "protoc-gen-scala",
    out = "{BIN_DIR}/{PACKAGE}/{PROTO_LIBRARY_BASENAME}_scala.srcjar",
    options = ["flat_package"],
    tool = ":protoc-gen-scala_bin",
    visibility = ["//visibility:public"],
)

proto_plugin(
    name = "protoc-gen-scala-grpc",
    out = "{BIN_DIR}/{PACKAGE}/{PROTO_LIBRARY_BASENAME}_scala_grpc.srcjar",
    options = [
        "flat_package",
        "grpc",
    ],
    tool = ":protoc-gen-scala_bin",
    visibility = ["//visibility:public"],
)

java_binary(
    name = "protoc-gen-scala_bin",
    main_class = "scalapb.ScalaPbCodeGenerator",
    runtime_deps = [
        "@maven_scala//:com_thesamet_scalapb_compilerplugin_2_12",
        "@maven_scala//:com_thesamet_scalapb_protoc_bridge_2_12",
    ],
)

filegroup(
    name = "all_files",
    testonly = True,
    srcs = ["BUILD.bazel"],
    visibility = ["//plugin:__pkg__"],
)
